<?php
class RegisterAction extends Action{
	public function register(){
		$this->display();
	}

	public function doReg(){
		/*$username=$_POST['username'];
		$password1=$_POST['password'];
		$password2=$_POST['password2'];*/
		//$verify=$_POST['verify'];
		//$sex=$_POST['sex'];
		//$user=M('user');
		//D方法才会去找model里面的user类
		$user=D('User');
		//dump($user);
		//if(md5($verify)!=$_SESSION['verify']){
		//	$this->error('验证码错误');
		//}
		//if($password2==$password1){	
			/*$data['username']=$username;
			$data['password']=$password;
			$data['sex']=$sex;
			$lastId=$user->add($data);*/

			$flag=$user->create();
			if(!$flag){
				$this->error($user->getError());
			}else{

			}
			$lastId=$user->add();
			if($lastId){
				$this->success('用户注册成功，请登录',U('Login/login'));
			}else{
				$this->error('用户注册失败');
			}
		}

	}



?>
